﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Threading;

namespace DataGener
{
    class Program
    {
        void generFun()
        {

        }

        static void createScalesFile(string fileName,int call, int lam, int var)
        {
            FileStream fileStream = new FileStream(fileName, FileMode.Create);
            using (StreamWriter sw = new StreamWriter(fileStream))
            {
                fileStream.Seek(0, SeekOrigin.End);
                sw.Write(" " + call);
                sw.Write(" " + lam);
                sw.Write(" " + var);
                sw.Close();
            }
        }

        static bool newNumInList(List<int> list, int number)
        {
            foreach(int el in list) {
                if(el == number) {
                    return false;
                }
            }
            return true;
        }

        static void createFun(string fileName, int scaleVec, int maxValueVar)
        {
            List<int> vec = new List<int>();
            Random rand = new Random();
            int temp;

            for (int i = 0; i < scaleVec; i++)
            {
   //             do 
   //             {
                    temp = rand.Next(maxValueVar);
  //              } while(!newNumInList(vec, temp));    
                vec.Add(temp);
            }

            FileStream fileStream = new FileStream(fileName, FileMode.Create);
            using (StreamWriter sw = new StreamWriter(fileStream))
            {
                fileStream.Seek(0, SeekOrigin.End);
                foreach(int curNum in vec) {
                    sw.Write(" " + curNum);
                }
                sw.Close();
            }

        }

        static void createVar(string fileName,int start, int end)
        {
            FileStream fileStream = new FileStream(fileName, FileMode.Create);
            using (StreamWriter sw = new StreamWriter(fileStream))
            {
                fileStream.Seek(0, SeekOrigin.End);
                for (int i = start; i < end; i++)
                {
                    sw.Write(" " + i);
                }
                sw.Close();
            }
        }

        static void Main(string[] args)
        {
            int call = 11000;
            int lam = 9000;
            int var = lam*2;
            createScalesFile("D:\\learn\\learn\\6_sem\\Kursach\\EigenCFASparse\\EigenCFASparse\\scales.txt",call, lam, var);
            createFun("D:\\learn\\learn\\6_sem\\Kursach\\EigenCFASparse\\EigenCFASparse\\Fun.txt", call, lam*3);
            Thread.Sleep(50);
            createFun("D:\\learn\\learn\\6_sem\\Kursach\\EigenCFASparse\\EigenCFASparse\\Arg1.txt", call, lam*3);
            Thread.Sleep(70);
            createFun("D:\\learn\\learn\\6_sem\\Kursach\\EigenCFASparse\\EigenCFASparse\\Arg2.txt", call, lam*3);

        //    createVar("D:\\learn\\learn\\6_sem\\Kursach\\EigenCFASparse\\EigenCFASparse\\Var1.txt", 0, var / 2);
        //    createVar("D:\\learn\\learn\\6_sem\\Kursach\\EigenCFASparse\\EigenCFASparse\\Var2.txt", var / 2, var);

        }
    }
}
